﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using seoWebApplication.st.SharkTankDAL;
using seoWebApplication.st.SharkTankDAL.entObject;

namespace seoWebApplication
{
    public partial class customer : System.Web.UI.Page
    {
        private const string VIEW_STATE_KEY_customer = "customer";
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadScreenFromObject();
        }

        protected void LoadObjectFromScreen()
        {
            customerEO customer = new customerEO();
            
            customer.fname = txtfname.Text;

            customer.lname = txtlname.Text;

            customer.address1 = txtaddress1.Text;

            customer.address2 = txtaddress2.Text;

            customer.city = txtcity.Text;

            customer.region = txtregion.Text;

            customer.zip = txtzip.Text;

            customer.country = txtcountry.Text;

            customer.shippingRegion = txtshippingRegion.Text;

            customer.dayPhone = Convert.ToDecimal(txtdayPhone.Text);

            customer.cellPhone = Convert.ToDecimal(txtcellPhone.Text);

            customer.evePhone = Convert.ToDecimal(txtevePhone.Text);

            customer.creditCard = txtcreditCard.Text;

            customer.username = txtusername.Text;

            customer.password = txtpassword.Text;

            customer.email = txtemail.Text;
        }

        protected void LoadScreenFromObject()
        {
            customerEO customer = new customerEO();
            int id = 11;
            customer.Load(id);
              
            txtfname.Text = Convert.ToString(customer.fname);

            txtlname.Text = Convert.ToString(customer.lname);

            txtaddress1.Text = Convert.ToString(customer.address1);

            txtaddress2.Text = Convert.ToString(customer.address2);

            txtcity.Text = Convert.ToString(customer.city);

            txtregion.Text = Convert.ToString(customer.region);

            txtzip.Text = Convert.ToString(customer.zip);

            txtcountry.Text = Convert.ToString(customer.country);

            txtshippingRegion.Text = Convert.ToString(customer.shippingRegion);

            txtdayPhone.Text = Convert.ToString(customer.dayPhone);

            txtcellPhone.Text = Convert.ToString(customer.cellPhone);

            txtevePhone.Text = Convert.ToString(customer.evePhone);

            txtcreditCard.Text = Convert.ToString(customer.creditCard);

            txtusername.Text = Convert.ToString(customer.username);

            txtpassword.Text = Convert.ToString(customer.password);

            txtemail.Text = Convert.ToString(customer.email);
             
          
 
            //Put the object in the view state so it can be attached back to the data context.
            ViewState[VIEW_STATE_KEY_customer] = customer;
        }
    }
}